/*

Note  	Frequency (Hz) 	Wavelength (cm)
C0 	16.35 	2100.
C#0/Db0 	17.32 	1990.
D0 	18.35 	1870.
D#0/Eb0 	19.45 	1770.
E0 	20.60 	1670.
F0 	21.83 	1580.
F#0/Gb0 	23.12 	1490.
G0 	24.50 	1400.
G#0/Ab0 	25.96 	1320.
A0 	27.50 	1250.
A#0/Bb0 	29.14 	1180.
B0 	30.87 	1110.
C1 	32.70 	1050.
C#1/Db1 	34.65 	996.
D1 	36.71 	940.
D#1/Eb1 	38.89 	887.
E1 	41.20 	837.
F1 	43.65 	790.
F#1/Gb1 	46.25 	746.
G1 	49.00 	704.
G#1/Ab1 	51.91 	665.
A1 	55.00 	627.
A#1/Bb1 	58.27 	592.
B1 	61.74 	559.
C2 	65.41 	527.
C#2/Db2 	69.30 	498.
D2 	73.42 	470.
D#2/Eb2 	77.78 	444.
E2 	82.41 	419.
F2 	87.31 	395.
F#2/Gb2 	92.50 	373.
G2 	98.00 	352.
G#2/Ab2 	103.83 	332.
A2 	110.00 	314.
A#2/Bb2 	116.54 	296.
B2 	123.47 	279.
C3 	130.81 	264.
C#3/Db3 	138.59 	249.
D3 	146.83 	235.
D#3/Eb3 	155.56 	222.
E3 	164.81 	209.
F3 	174.61 	198.
F#3/Gb3 	185.00 	186.
G3 	196.00 	176.
G#3/Ab3 	207.65 	166.
A3 	220.00 	157.
A#3/Bb3 	233.08 	148.
B3 	246.94 	140.
C4 	261.63 	132.
C#4/Db4 	277.18 	124.
D4 	293.66 	117.
D#4/Eb4 	311.13 	111.
E4 	329.63 	105.
F4 	349.23 	98.8
F#4/Gb4 	369.99 	93.2
G4 	392.00 	88.0
G#4/Ab4 	415.30 	83.1
A4 	440.00 	78.4
A#4/Bb4 	466.16 	74.0
B4 	493.88 	69.9
C5 	523.25 	65.9
C#5/Db5 	554.37 	62.2
D5 	587.33 	58.7
D#5/Eb5 	622.25 	55.4
E5 	659.26 	52.3
F5 	698.46 	49.4
F#5/Gb5 	739.99 	46.6
G5 	783.99 	44.0
G#5/Ab5 	830.61 	41.5
A5 	880.00 	39.2
A#5/Bb5 	932.33 	37.0
B5 	987.77 	34.9
C6 	1046.50 	33.0
C#6/Db6 	1108.73 	31.1
D6 	1174.66 	29.4
D#6/Eb6 	1244.51 	27.7
E6 	1318.51 	26.2
F6 	1396.91 	24.7
F#6/Gb6 	1479.98 	23.3
G6 	1567.98 	22.0
G#6/Ab6 	1661.22 	20.8
A6 	1760.00 	19.6
A#6/Bb6 	1864.66 	18.5
B6 	1975.53 	17.5
C7 	2093.00 	16.5
C#7/Db7 	2217.46 	15.6
D7 	2349.32 	14.7
D#7/Eb7 	2489.02 	13.9
E7 	2637.02 	13.1
F7 	2793.83 	12.3
F#7/Gb7 	2959.96 	11.7
G7 	3135.96 	11.0
G#7/Ab7 	3322.44 	10.4
A7 	3520.00 	9.8
A#7/Bb7 	3729.31 	9.3
B7 	3951.07 	8.7
C8 	4186.01 	8.2
C#8/Db8 	4434.92 	7.8
D8 	4698.64 	7.3
D#8/Eb8 	4978.03 	6.9
*/

#define C0    16
#define CS0   17
#define D0    18
#define DS0   19
#define E0    20
#define F0    21
#define FS0   23
#define G0    24
#define GS0   25
#define A0    27
#define AS0   29
#define B0    30
#define C1    32
#define CS1   34
#define D1    36
#define DS1   38
#define E1    41
#define F1    43
#define FS1   46
#define G1    49
#define GS1   51
#define A1    55
#define AS1   58
#define B1    61
#define C2    65
#define CS2   69
#define D2    73
#define DS2   77
#define E2    82
#define F2    87
#define FS2   92
#define G2    98
#define GS2  103
#define A2   110
#define AS2  116
#define B2   123
#define C3   130
#define CS3  138
#define D3   146
#define DS3  155
#define E3   164
#define F3   174
#define FS3  185
#define G3   196
#define GS3  207
#define A3   220
#define AS3  233
#define B3   246
#define C4   261
#define CS4  277
#define D4   293
#define DS4  311
#define E4   329
#define F4   349
#define FS4  369
#define G4   392
#define GS4  415
#define A4   440
#define AS4  466
#define B4   493
#define C5   523
#define CS5  554
#define D5   587
#define DS5  622
#define E5   659
#define F5   698
#define FS5  739
#define G5   783
#define GS5  830
#define A5   880
#define AS5  932
#define B5   987
#define C6  1046
#define CS6 1108
#define D6  1174
#define DS6 1244
#define E6  1318
#define F6  1396
#define FS6 1479
#define G6  1567
#define GS6 1661
#define A6  1760
#define AS6 1864
#define B6  1975
#define C7  2093
#define CS7 2217
#define D7  2349
#define DS7 2489
#define E7  2637
#define F7  2793
#define FS7 2959
#define G7  3135
#define GS7 3322
#define A7  3520
#define AS7 3729
#define B7  3951
#define C8  4186
#define CS8 4434
#define D8  4698
#define DS8 4978


void play_note(char note, short sharp, short octave) {
	int freq = NF_A5;
	switch (note) {
		case 'A':
		case 'a':
			freq = sharp ? 3729 : 3520;
			break;

		case 'B':
		case 'b':
			freq = 3951;
			break;

		case 'C':
		case 'c':
			freq = sharp ? 2217 : 2093;
			break;

		case 'D':
		case 'd':
			freq = sharp ? 2489 : 2349;
			break;

		case 'E':
		case 'e':
			freq = 2637;
			break;

		case 'F':
		case 'f':
			freq = sharp ? 2960 : 2794;
			break;

		case 'G':
		case 'g':
			freq = sharp ? 3322 : 3136;
			break;

	}





	set_timer1(freq);
}